# $Id$
# Maintainer: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>

pkgname=aisleriot
pkgver=3.22.3
pkgrel=1
pkgdesc="A collection of patience games written in guile scheme"
url="https://wiki.gnome.org/Apps/Aisleriot"
arch=(i686 x86_64)
license=(GPL)
groups=(gnome-extra)
depends=(guile gtk3 librsvg libcanberra gconf dconf)
makedepends=(intltool itstool docbook-xsl yelp-tools appdata-tools gnome-common git)
optdepends=('libkdegames: KDE card sets'
            'pysolfc: PySol card sets'
            'pysolfc-cardsets: PySol card sets')
options=(!emptydirs)
_commit=d83860d68e78d87351cd6faf6d9cb67d724dc1d3  # tags/3.22.3^0
source=("git+https://git.gnome.org/browse/aisleriot#commit=$_commit")
sha256sums=('SKIP')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/-/+/g'
}

prepare() {
  cd $pkgname
  NOCONFIGURE=1 ./autogen.sh
}

build() {
  cd $pkgname

  ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
    --libexecdir=/usr/lib --disable-static \
    --with-kde-card-theme-path=/usr/share/carddecks \
    --with-pysol-card-theme-path=/usr/share/PySolFC

  # https://bugzilla.gnome.org/show_bug.cgi?id=655517
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool

  make
}

package() {
  cd $pkgname
  make DESTDIR="$pkgdir" install GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1
  install -d "$pkgdir/usr/share/gconf/schemas"
  gconf-merge-schema "$pkgdir/usr/share/gconf/schemas/$pkgname.schemas" \
    --domain aisleriot "$pkgdir"/etc/gconf/schemas/*.schemas
  rm -f "$pkgdir"/etc/gconf/schemas/*.schemas
}
